/**
 * sidebar
 * 左侧菜单的样式，有暗色和亮色两种主题
 */

// 菜单样式
.i-layout-menu-side {
  background: var(--side-bg) !important;

  // 隐藏菜单滚动条
  &-scrollbar-hide {
    &::-webkit-scrollbar {
      width: 0;
    }
  }

  // 隐藏after伪类
  &::after {
    display: none !important;
  }
  // 菜单徽标样式
  &-badge {
    position: absolute !important;
    top: 16px;
    right: 46px;
    .ivu-badge-count {
      box-shadow: none;
    }
  }

  // 菜单样式
  &-submenu {
    background: var(--side-bg) !important;
    // svg图标和右侧箭头
    .svg-icon,
    .sub-ivu-icon {
      margin-right: 8px;
    }
    .ivu-menu-submenu-title-icon {
      margin-right: 0;
    }

    // 第一层菜单
    .ivu-menu-submenu {
      .ivu-menu-submenu-title {
        background: var(--side-bg) !important;
      }
    }
    // 第二层菜单
    .ivu-menu-item {
      height: 48px;
      overflow: hidden;
      display: flex;
      align-items: center;
      .i-layout-menu-side-submenu-subtitle {
        display: block;
        font-style: normal;
        font-size: 12px;
        opacity: 0.5;
      }
    }
  }

  // 只有一层子菜单，提取到第一层后，选中无背景
  & > .i-layout-menu-side-submenu > .ivu-menu-item {
    background-color: transparent !important;
  }

  // 菜单折叠
  &-collapse {
    position: static !important;
    background: var(--side-bg) !important;

    // 左侧菜单栏
    &-top-level {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      display: block;
      text-align: center;
      margin-top: 6px;

      // 图标
      .svg-icon,
      .sub-ivu-icon {
        margin-right: 0;
      }
      &-item {
        background: transparent !important;
      }

      // 左侧菜单-有子菜单
      > .ivu-tooltip,
      > .ivu-dropdown {
        display: flex;
        align-items: center;
        > .ivu-dropdown-rel,
        > .ivu-tooltip-rel {
          flex: 1;
          .ivu-menu-item {
            transition: all 0.28s;
            padding: 10px 0px;
            margin: 0px 8px;
            border-radius: 4px;
          }
        }
      }

      // 弹框菜单
      .ivu-select-dropdown {
        margin: 5px 0 5px 3px;
        min-width: 140px;

        // 多级菜单项
        .ivu-dropdown-item {
          display: flex;
          align-items: center;
          overflow: hidden;
          position: relative;
          transition: all 0.2s ease-in-out;
          margin-top: 4px;

          // 隐藏多级菜单最右侧的线
          &.ivu-menu-item-active::after {
            width: 0 !important;
          }

          // 包含下级菜单的图标箭头样式
          &-arrow {
            position: absolute;
            top: 0;
            right: 16px;
            bottom: 0;
            left: auto;
            width: 14px;
            height: 14px;
            margin: auto;
          }

          // 开启父级标题
          &.ivu-dropdown-show-parent {
            cursor: default;
            background: none !important;
            font-weight: 600;
            .svg-icon,
            .sub-ivu-icon {
              margin-right: 8px;
            }
          }

          // 开启副标题
          .i-layout-menu-side-submenu-subtitle {
            margin-left: 12px;
            font-style: normal;
            font-size: 12px;
            opacity: 0.5;
          }
        }
      }
    }

    // 折叠模式-dark主题
    &.ivu-menu-dark {
      // 左侧菜单
      .ivu-dropdown-rel,
      .ivu-tooltip-rel {
        // 菜单项
        .ivu-menu-item:not(.i-layout-menu-side-collapse-top-level-item-selected) {
          &:hover {
            background: #373c54 !important;
          }
          &:active {
            background: #2b2f42 !important;
          }
        }
        // 选中
        .i-layout-menu-side-collapse-top-level-item-selected {
          color: #fff !important;
          background: var(--primary-color) !important;
          &:hover {
            background: var(--primary-color);
          }
        }
      }

      // 弹框菜单
      .ivu-select-dropdown {
        background: var(--side-bg) !important;

        // 子菜单
        .ivu-dropdown-item {
          color: rgba(255, 255, 255, 0.7);
          // 当前被选中的样式
          &.ivu-menu-item-selected.ivu-menu-item-active {
            background: var(--primary-color) !important;
            color: #fff;
          }
          &:hover {
            background: transparent;
            color: #fff;
          }
        }
        // 父级标题
        .ivu-dropdown-show-parent {
          &:hover {
            color: rgba(255, 255, 255, 0.7);
          }
        }
      }
    }

    // 折叠模式-light主题
    &.ivu-menu-light {
      // 左侧菜单
      .ivu-dropdown-rel,
      .ivu-tooltip-rel {
        // 菜单项
        .ivu-menu-item:not(.i-layout-menu-side-collapse-top-level-item-selected) {
          &:hover {
            background: var(--primary-lighten90) !important;
          }
          &:active {
            background: var(--primary-lighten80) !important;
          }
        }
        // 选中
        .i-layout-menu-side-collapse-top-level-item-selected {
          color: #fff !important;
          background: var(--primary-color) !important;
          &:hover {
            background: var(--primary-color);
          }
        }
      }

      // 弹框菜单
      .ivu-select-dropdown {
        // 子菜单
        .ivu-dropdown-item {
          // 当前被选中的样式
          &.ivu-menu-item-selected.ivu-menu-item-active {
            background: var(--primary-lighten90) !important;
            color: var(--primary-color);
          }
        }
      }
    }
  }
}
